BackGround={};
local this = BackGround;
local gameObject;
local transform;
function BackGround.New()
    resMgr:LoadPrefab("background",{"BackGround"},this.LoadOK);
end
function BackGround.LoadOK(objs)
  gameObject=newObject(objs[0]);
  transform=gameObject.transform;
  transform.position=Vector3(0,0,10);

  this.quad=transform:Find("quad"):GetComponent("MeshRenderer").material;
  this.quad2=transform:Find("quad2"):GetComponent("MeshRenderer").material;
  this.quad3=transform:Find("quad3"):GetComponent("MeshRenderer").material;

  UpdateBeat:Add(this.Update);

end
function BackGround.Update()
    this.Scroll(this.quad,0.1);
    this.Scroll(this.quad2,0.3);
    this.Scroll(this.quad3,0.2);

end
function BackGround.Scroll(mat,speed)
    mat.mainTextureOffset=mat.mainTextureOffset+Vector2.up*speed*Time.deltaTime;
end